<?php
/**
 * Created by PhpStorm.
 * User: dingding
 * Date: 2017/7/31
 * Time: 10:43
 */
 $task =  urldecode($_GET['state']);
// echo $task;
?>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <!-- meta使用viewport以确保页面可自由缩放 -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <script type="text/javascript" src="js/jquery-3.2.1.js"></script>

    <script type="text/javascript" src="js/bootstrap.min.js"></script>
<!--    <script type="text/javascript" src="http://api.map.baidu.com/api?v=1.2"></script>-->
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=xZXH3sRzkIgsZa70oqf9uDzScnSb13Il"></script>

    <title>任务详情</title>
    <link rel="stylesheet" href="css/global.css" />
    <link rel="stylesheet" href="css/acceptOngoing.css" />
</head>
<body>

<div class="my-container">
    <div >
        <div id="hideMap" style="display: none"></div>
        <table  class="table table-striped table-condensed" >
            <thead>
            <h4 id="accept-stage-title" style="font-weight: bold"></h4>
            </thead>
            <tbody>
            <tr>
                <td class="td1">阶段：&nbsp</td>
                <td id="accept-current-stage" class="td2"></td>
            </tr>
            <tr>
                <td class="td1">任务：&nbsp</td>
                <td id="accept-stage-task" class="td2"></td>
            </tr>
            <tr>
                <td class="td1">契约：&nbsp</td>
                <td id="accept-contract-time" class="td2"></td>
            </tr>
            <tr>
                <td class="td1">报酬：&nbsp</td>
                <td id="accept-stage-reward" class="td2"></td>
            </tr>
            </tbody>
        </table>
        <table id="accept-ongoing-detail-table" >
            <tbody>

            </tbody>
        </table>
        <table id="feeback-table" class="table table-condensed">
            <tbody>

            </tbody>
        </table>
        <a href="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx751e041cdef857d6&redirect_uri=http%3a%2f%2f118.178.94.215%2facceptOngoing.php&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect" type="button" class="btn btn-default btn-lg">
            返回
        </a>
        <button type="button" class="btn btn-primary pull-right btn-lg" id="finish-task">
            完成任务
        </button>
    </div>

</div>

<div class="modal fade" id="finishPopup">
    <div class="modal-dialog"  >
        <div class="modal-content">
            <div class="modal-header">
                <h4>确认完成任务</h4>
            </div>
            <div class="modal-body">
                确认提交您完成的任务吗？
            </div>

            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">
                    返回
                </button>
                <button type="button" class="btn btn-primary" id="confirm-finish-task">
                    确定
                </button>
            </div>

        </div>
    </div>
</div>

<div class="modal fade" id="checkMap" >
    <div class="modal-dialog" style="margin:0 5px;">
        <div class="modal-content">
            <div class="modal-body" id="bmap" style="height:500px;padding:0"></div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>


</body>

<script type="text/javascript">

    //当前正在查看的任务详情
    var currentAcceptTask = -1;
    //为了计算当前位置与目标的距离
    var hideMap = new BMap.Map("hideMap");
    //完成任务的反馈
    var feedbacks = [], startImgFeedback = {}, endImgFeedback = {};
    var lat, lng;

    $(function(){
        var result = <?php echo $task;?>;
        currentAcceptTask  = JSON.parse(JSON.stringify(<?php echo $task;?>).trim().replace(/\n/g,":"));
        createAcceptTaskDetail();
    });

    $('#finish-task').on('click', function(){
        $('#finishPopup').modal('show');
        $('#finishPopup').on('shown.bs.modal', function(){
            var h = ($('#finishPopup').height() - $('#finishPopup .modal-dialog').height()) / 2;
            $('#finishPopup .modal-dialog').css('top',h+"px");
        });
    });

    $('#confirm-finish-task').on('click', function(){
        checkFeedback();
    });


    function createAcceptTaskDetail(){
        $('#accept-stage-title').html(currentAcceptTask['stageDesc']);
        $('#accept-current-stage').html(currentAcceptTask['currentStage']);
        $('#accept-stage-task').html(currentAcceptTask['taskTitle']);
        $('#accept-contract-time').html(currentAcceptTask['contract']);
        $('#accept-stage-reward').html(currentAcceptTask['reward']);
        var acceptTable = $('#accept-ongoing-detail-table tbody');
        acceptTable.html('');
        var feedbackTable = $('#feeback-table tbody');
        feedbackTable.html('');
        //起点
        if(currentAcceptTask.locations[0] != null && currentAcceptTask.locations[0].type != -1){
            var location = currentAcceptTask.locations[0];
            acceptTable.append(createLocationHeader(location.type));
            acceptTable.append(createTableRow( "地址：", location['address'].replace("=","\n")));
            acceptTable.append("<tr  style='text-align: center'><td colspan='2'><button type='button' class='btn btn-warning' onclick='check_map(" + location.latitude + "," + location.longitude + ")'>查看路线</button></td></tr>")
            var inputs = location.inputs;
            if(null != inputs && inputs.length > 0){
                acceptTable.append("<tr style='font-weight: bold'> <td colspan='2' ><h4><span class='label label-danger'>额外信息</span></h4></td> </tr>");
                for(var k=0; k<inputs.length; k++){
                    acceptTable.append(createTableRow(inputs[k]['desc']+":&nbsp", inputs[k]['value']));
                }
            }
            var outputs = location.outputs;
            if(null != outputs && outputs.length > 0){
                acceptTable.append("<tr style='font-weight: bold'> <td colspan='2' ><h4><span class='label label-success'>反馈</span></h4></td> </tr>");
                for(var k=0; k<outputs.length; k++){
                    var output = outputs[k];
                    if(output['type'] == 0){ //picture
//                        feedbackTable.append("<tr> <td colspan='2'>" + output.desc + ": " + "</td> </tr>");
                        feedbackTable.append("<tr> <td colspan='2'>" + output.desc + ": </br></br>" +"<div style='text-align: center'><img id='startImg'  alt='' style='max-width:100%;max-height:300px;margin:auto 0;'/><input name='startFile' id='startFile' type='file' accept='image/*;capture=camera' onchange='change(1)' /></div></td> </tr>");
//                        feedbackTable.append("<tr> <td colspan='2' style='text-align: center'><img id='startImg'  alt='' style='max-width:100%;max-height:300px;margin:auto 0;'/></td> </tr>");
                    } else { //text/num/enum
                        switch (output['type']) {
                            case 1:
                                feedbackTable.append("<tr> <td class='td1'>"+ output.desc +":&nbsp</td> <td class='td2'><input type='text' class='start-location-text form-control'/></td> </tr>");
                                break;
                            case 2:
                                feedbackTable.append("<tr> <td class='td1'>"+ output.desc +":&nbsp</td> <td class='td2'><input type='number' class='start-location-number form-control'/></td> </tr>");
                                break;
                            case 3:
                                var s = "<tr> <td class='td1 start-location-text'>"+ output.desc +":&nbsp</td> <td class='td2'><select  class='start-location-enum form-control'>";
                                var options = output.entries.split(';');
                                for( var m = 0; m < options.length; m++){
                                    s += "<option value='"+ options[m] + "'>" + options[m] +"</option>";
                                }
                                s += "</select></td> </tr>";
                                feedbackTable.append(s);
                                break;
                        }
                    }
                }
            }
        }

        //终点
        if(currentAcceptTask.locations[1] != null && currentAcceptTask.locations[1].type != -1){
            var location = currentAcceptTask.locations[1];
            acceptTable.append(createLocationHeader(location.type));
            acceptTable.append(createTableRow( "地址：", location['address'].replace("=","\n")));
            acceptTable.append("<tr  style='text-align: center'><td colspan='2'><button type='button' class='btn btn-warning' onclick='check_map(" + location.latitude + "," + location.longitude + ")'>查看路线</button></td></tr>")
            var inputs = location.inputs;
            if(null != inputs && inputs.length > 0){
                acceptTable.append("<tr style='font-weight: bold'> <td colspan='2' ><h4><span class='label label-danger'>额外信息</span></h4></td> </tr>");
                for(var k=0; k<inputs.length; k++){
                    acceptTable.append(createTableRow(inputs[k]['desc']+":&nbsp", inputs[k]['value']));
                }
            }
            var outputs = location.outputs;
            if(null != outputs && outputs.length > 0){
                acceptTable.append("<tr style='font-weight: bold'> <td colspan='2' ><h4><span class='label label-success'>反馈</span></h4></td> </tr>");
                for(var k=0; k<outputs.length; k++){
                    var output = outputs[k];
                    if(output['type'] == 0){ //picture
                        feedbackTable.append("<tr> <td colspan='2'>" + output.desc + ": </br></br>" +"<div style='text-align: center'><img id='endImg'  alt='' style='max-width:100%;max-height:300px;margin:auto 0;'/><input name='endFile' id='endFile' type='file' accept='image/*;capture=camera' onchange='change(2)' /></div></td> </tr>");
//                        feedbackTable.append("<tr> <td colspan='2'>" + output.desc + "</td> </tr>");
//                        feedbackTable.append("<tr> <td colspan='2'><input name='endFile' id='endFile' type='file' accept='image/*;capture=camera' onchange='change(2)' /></td> </tr>");
//                        feedbackTable.append("<tr> <td colspan='2' style='text-align: center'><img id='endImg'  alt='' style='max-width:100%;max-height:300px;margin:auto 0;'/></td> </tr>");
                    } else { //text/num/enum
                        switch (output['type']) {
                            case 1:
                                feedbackTable.append("<tr> <td class='td1'>"+ output.desc +":&nbsp</td> <td class='td2'><input type='text' class='end-location-text  form-control'/></td> </tr>");
                                break;
                            case 2:
                                feedbackTable.append("<tr> <td class='td1'>"+ output.desc +":&nbsp</td> <td class='td2'><input type='number' class='end-location-number  form-control'/></td> </tr>");
                                break;
                            case 3:
                                var s = "<tr> <td class='td1'>"+ output.desc +":&nbsp</td> <td class='td2'><select class='end-location-enum  form-control'>";
                                var options = output.entries.split(';');
                                for( var m = 0; m < options.length; m++){
                                    s += "<option value='"+ options[m] + "'>" + options[m] +"</option>";
                                }
                                s += "</select></td> </tr>";
                                feedbackTable.append(s);
                                break;
                        }
                    }
                }
            }

        }

    }

    function check_map(lat, lng){
        setTimeout(function() {		//添加延时加载。解决问题
            $('#checkMap').modal('show');
            $('#checkMap').on('shown.bs.modal', function(){
                var map = new BMap.Map("bmap");
                //右上角,仅包含平移和缩放按钮
                var bottom_right_navigation = new BMap.NavigationControl({anchor: BMAP_ANCHOR_BOTTOM_RIGHT, type: BMAP_NAVIGATION_CONTROL_ZOOM});
                map.addControl(bottom_right_navigation);
                var target = new BMap.Point(lng,lat);
                //定位
                var geolocation = new BMap.Geolocation();
                geolocation.getCurrentPosition(function(r){
                    if(this.getStatus() == BMAP_STATUS_SUCCESS){
                        //步行路线规划
                        var walking = new BMap.WalkingRoute(map, {renderOptions:{map: map, autoViewport: true}});
                        walking.search(r.point, target);
                    }
                    else {
                        alert('failed'+this.getStatus());
                    }
                },{enableHighAccuracy: true});
            });
        },300);

    }

    function createLocationHeader(type){
        var h="";
        if(type == 0){
            h = "<tr style='font-weight: bold'> <td colspan='2' style='text-align: center' ><h3><span class='label label-primary'>起点</span></h3></td> </tr>";
        } else if(type == 1){
            h = "<tr style='font-weight: bold'> <td colspan='2' style='text-align: center' ><h3><span class='label label-primary'>终点</span></h3></td> </tr>";
        }
        return h;
    }

    function createTableRow(key, value){
        var row = " <tr> <td class='td1'>"+key+"</td> <td class='td2'>"+value+"</td> </tr>";
        return row;
    }

    function change(flag) {
        var pic , file;
        if(flag == 1){
            pic = document.getElementById("startImg");
            file = document.getElementById("startFile");
        } else {
            pic = document.getElementById("endImg");
            file = document.getElementById("endFile");
        }

        var ext=file.value.substring(file.value.lastIndexOf(".")+1).toLowerCase();

        // gif在IE浏览器暂时无法显示
        if(ext!='png' && ext!='jpg' && ext!='jpeg'){
            alert("图片的格式必须为png或者jpg或者jpeg格式！");
            return;
        }
        var isIE = navigator.userAgent.match(/MSIE/)!= null,
            isIE6 = navigator.userAgent.match(/MSIE 6.0/)!= null;

        if(isIE) {
            file.select();
            var reallocalpath = document.selection.createRange().text;

            // IE6浏览器设置img的src为本地路径可以直接显示图片
            if (isIE6) {
                pic.src = reallocalpath;
            }else {
                // 非IE6版本的IE由于安全问题直接设置img的src无法显示本地图片，但是可以通过滤镜来实现
                pic.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='image',src=\"" + reallocalpath + "\")";
                // 设置img的src为base64编码的透明图片 取消显示浏览器默认图片
                pic.src = '';
            }
        }else {
            html5Reader(file, pic);
        }
    }

    function html5Reader(file, pic){
        var file = file.files[0];
        var reader = new FileReader();
        reader.readAsDataURL(file);
        reader.onload = function(e){
            pic.src=this.result;
        }
    }

    //确认反馈是否全部填写正确
    function checkFeedback(){
        var filled = 1;
        feedbacks = [];
        startImgFeedback = {};
        endImgFeedback = {};
        //起点
        var start = currentAcceptTask.locations[0];
        if(start != null && start.type != -1){
            var textIndex = 0, numIndex = 0, enumIndex = 0;
            for(var i = 0; i < start.outputs.length; i++){
                var output = start.outputs[i];
                if(output.type == 0){
                    if(document.getElementById('startFile').files[0] == null){
                        filled = 0;
                    } else {
                        startImgFeedback.id = output.id;
                        startImgFeedback.type = output.type;
                        startImgFeedback.actionId = output.actionId;
                        startImgFeedback.desc = output.desc;
                        startImgFeedback.isActive = output.isActive;
                        startImgFeedback.intervalValue = output.intervalValue;
                        startImgFeedback.upBound = output.upBound;
                        startImgFeedback.lowBound = output.lowBound;
                        startImgFeedback.entries = output.entries;
                        startImgFeedback.aggregaMethod = output.aggregaMethod;

                    }
                } else {
                    var out = {};
                    out.id = output.id;
                    out.type = output.type;
                    out.actionId = output.actionId;
                    out.desc = output.desc;
                    out.isActive = output.isActive;
                    out.intervalValue = output.intervalValue;
                    out.upBound = output.upBound;
                    out.lowBound = output.lowBound;
                    out.entries = output.entries;
                    out.aggregaMethod = output.aggregaMethod;
                    if(output.type == 1){//text
                        var text = $('.start-location-text')[textIndex++];
                        if(text.value == ""){
                            filled = 0;
                            console.log("text:"+text.value);
                        } else {
                            out.value = text.value;
                        }
                    } else if(output.type == 2){//number
                        var number= $('.start-location-number')[numIndex++];
                        if(number.value == ""){
                            filled = 0;
                            console.log("number"+number.value);
                        } else {
                            out.value = number.value;
                        }
                    } else if(output.type == 3){//enum
                        var en = $('.start-location-enum')[enumIndex++];
                        out.value = en.options[en.selectedIndex].text;
                    }
                    feedbacks.push(out);
                }
            }
        }

        //终点
        var end = currentAcceptTask.locations[1];
        if(end != null && end.type != -1){
            var textIndex = 0, numIndex = 0, enumIndex = 0;
            for(var i = 0; i < end.outputs.length; i++){
                var output = end.outputs[i];
                if(output.type == 0){
                    if(document.getElementById('endFile').files[0] == null){
                        filled = 0;
                    } else {
                        endImgFeedback.id = output.id;
                        endImgFeedback.type = output.type;
                        endImgFeedback.actionId = output.actionId;
                        endImgFeedback.desc = output.desc;
                        endImgFeedback.isActive = output.isActive;
                        endImgFeedback.intervalValue = output.intervalValue;
                        endImgFeedback.upBound = output.upBound;
                        endImgFeedback.lowBound = output.lowBound;
                        endImgFeedback.entries = output.entries;
                        endImgFeedback.aggregaMethod = output.aggregaMethod;

                    }
                } else {
                    var out = {};
                    out.id = output.id;
                    out.type = output.type;
                    out.actionId = output.actionId;
                    out.desc = output.desc;
                    out.isActive = output.isActive;
                    out.intervalValue = output.intervalValue;
                    out.upBound = output.upBound;
                    out.lowBound = output.lowBound;
                    out.entries = output.entries;
                    out.aggregaMethod = output.aggregaMethod;
                    if(output.type == 1){//text
                        var text = $('.end-location-text')[textIndex++];
                        if(text.value == ""){
                            filled = 0;
                        } else {
                            out.value = text.value;
                        }
                    } else if(output.type == 2){//number
                        var number= $('.end-location-number')[numIndex++];
                        if(number.value == ""){
                            filled = 0;
                        } else {
                            out.value = number.value;
                        }
                    } else if(output.type == 3){//enum
                        var en = $('.end-location-enum')[enumIndex++];
                        out.value = en.options[en.selectedIndex].text;
                    }
                    feedbacks.push(out);
                }
            }
        }

        if(filled == 1){
            var geolocation2 = new BMap.Geolocation();
            geolocation2.getCurrentPosition(function(r){
                if(this.getStatus() == BMAP_STATUS_SUCCESS){
                    var target = new BMap.Point(currentAcceptTask.locations[1].longitude, currentAcceptTask.locations[1].latitude);
                    var distance = Math.floor(hideMap.getDistance(r.point, target));
                    if(distance < 500){
                        lat = r.point.lat;
                        lng = r.point.lng;
//                        alert("您距离目标位置还有" + distance + "米！");
                        upload();
                    } else {
                        $('#finishPopup').modal('hide');
                        alert("您距离目标位置还有" + distance + "米！");
//                        upload();
                    }
                } else {
                    alert('failed'+this.getStatus());
                }
            },{enableHighAccuracy: true});

        } else {
            $('#finishPopup').modal('hide');
            alert("请正确填写所有反馈信息！");
        }

    }

    //上传图片到服务器
    function upload(){
        var url="uploadImage.php";
        var startPic = {} , endPic = {};
        if(document.getElementById('startFile') != null){
            startPic = document.getElementById('startFile').files[0];
        }
        if(document.getElementById('endFile') != null){
            endPic = document.getElementById('endFile').files[0];
        }
        var xhr = new XMLHttpRequest();
        var form = new FormData();
        form.append("startFile", startPic);
        form.append("endFile", endPic);
        xhr.open("POST", url, true);
        //在readystatechange事件上绑定一个事件处理函数
        xhr.onreadystatechange=callback;
        xhr.send(form);

        function callback() {
            if(xhr.readyState == 4 && xhr.status ==200){
                if(xhr.responseText == -1){
                    $('#finishPopup').modal('hide');
                    alert("上传图片失败");
                }else{
//                    $('#finishPopup').modal('hide');
//                    alert('添加成功');
                    var response = JSON.parse(xhr.responseText);
                    if(response.startImageUri != ""){
                        startImgFeedback.value = response.startImageUri;
                        feedbacks.push(startImgFeedback);
                    }
                    if( response.endImageUri != ""){
                        endImgFeedback.value =response.endImageUri;
                        feedbacks.push(endImgFeedback);
                    }
                    completeTask();
                }
            }
        }
    }



    //提交任务反馈表单
    function completeTask(){
        var action = "controller/completeTask.php";
//        alert(JSON.stringify(feedbacks));
        var data = {
            "userid":currentAcceptTask.userId,
            "stageid": currentAcceptTask.stageId,
            "finishtime": new Date().Format("yyyy-MM-dd HH:mm:ss"),
            "latitude": lat,
            "longitude": lng,
            "outputs":feedbacks
        };

        $.ajax({
            type: "POST",
            url: action,
            data: {data:JSON.stringify(data)},
            success: function(response)
            {
//                alert(response.trim());
                window.location.href="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx751e041cdef857d6&redirect_uri=http%3a%2f%2f118.178.94.215%2facceptOngoing.php&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect";
                $('#finishPopup').modal('hide');
            },
            error:function(request){
                $('#finishPopup').modal('hide');
                alert("connection error");
            }
        });

    }

    // 对Date的扩展，将 Date 转化为指定格式的String
    // 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符，
    // 年(y)可以用 1-4 个占位符，毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
    // 例子：
    // (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
    // (new Date()).Format("yyyy-M-d h:m:s.S")      ==> 2006-7-2 8:9:4.18
    Date.prototype.Format = function (fmt) { //author: meizz
        var o = {
            "M+": this.getMonth() + 1, //月份
            "d+": this.getDate(), //日
            "H+": this.getHours(), //小时
            "m+": this.getMinutes(), //分
            "s+": this.getSeconds(), //秒
            "q+": Math.floor((this.getMonth() + 3) / 3), //季度
            "S": this.getMilliseconds() //毫秒
        };
        if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (var k in o)
            if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
        return fmt;
    }


    //我接受的正在进行的任务列表
//    var accept_tasks = [
//        {
//            "bonusReward": 3760.42,
//            "currentStage": 8,
//            "ddl": 1490345137000,
//            "reward": 8962.73,
//            "stageId": 1,
//            "stageDesc": "jtest_description_1490345137348jtest_description_1490345137348jtest_description_1490345137348jtest_description_1490345137348jtest_description_1490345137348",
//            "stageName": "jtest_name_1490345137348",
//            "taskDeadline": 1490345137000,
//            "contract": "2017/6/21 18:30:00",
//            "taskDesc": "取快递取快递取快递取快递取快递取快递取快递取快递取快递",
//            "taskId": 45,
//            "taskProgress": "8/9",
//            "taskTitle": "取快递取快递取快递取快递取快递取快递取快递取快递取快递取快递取快递取快递取快递取快递取快递取快递取快递取快递取快递",
//            "locations": [
//                {
//                    "address": "jtest_address_1490345137403",
//                    "id": 67,
//                    "latitude": 31.1965,
//                    "longitude": 121.606,
//                    "stageId": 45,
//                    "type": 0,
//                    "inputs": [
//                        {
//                            "actionId": 34,
//                            "desc": "jtest_desc2",
//                            "id": 34,
//                            "type": 1,
//                            "value": "jtest_value_1490345137592"
//                        }
//                    ],
//                    "outputs": [
//                        {
//                            "id":1,
//                            "actionId":1,
//                            "type":0,
//                            "desc":"This is description",
//                            "value":"path/content",
//                            "isActive":true,
//                            "intervalValue":1,
//                            "upBound":10.0,
//                            "lowBound":2.0,
//                            "entries":"Yes;No",
//                            "aggregaMethod":1
//                        },
//                        {
//                            "id":1,
//                            "actionId":1,
//                            "type":1,
//                            "desc":"This is description",
//                            "value":"path/content",
//                            "isActive":true,
//                            "intervalValue":1,
//                            "upBound":10.0,
//                            "lowBound":2.0,
//                            "entries":"Yes;No",
//                            "aggregaMethod":1
//                        },
//                        {
//                            "id":1,
//                            "actionId":1,
//                            "type":2,
//                            "desc":"This is description",
//                            "value":"path/content",
//                            "isActive":true,
//                            "intervalValue":1,
//                            "upBound":10.0,
//                            "lowBound":2.0,
//                            "entries":"Yes;No",
//                            "aggregaMethod":1
//                        },
//                        {
//                            "id":1,
//                            "actionId":1,
//                            "type":3,
//                            "desc":"This is description",
//                            "value":"path/content",
//                            "isActive":true,
//                            "intervalValue":1,
//                            "upBound":10.0,
//                            "lowBound":2.0,
//                            "entries":"Yes;No",
//                            "aggregaMethod":1
//                        }
//                    ]
//                },
//                {
//                    "id": 0,
//                    "inputs": [],
//                    "latitude": 0,
//                    "longitude": 0,
//                    "outputs": [],
//                    "stageId": 0,
//                    "type": -1
//                }
//            ]
//        }
//    ];


</script>



</html>








